package cn.edu.controller;

import cn.edu.domain.User;
import cn.edu.service.User_loginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:David chan
 * @data:2022/8/5
 */
@RestController
@RequestMapping("/login")
public class User_loginController {

    @Autowired
    private User_loginService loginService;

    @RequestMapping("/col_login")
    public Result Col_login(int id,String password){
        User user = loginService.Col_login(id, password);
        if(user!= null){
            return new Result(Code.GET_OK,user);
        }else{
            return new Result(Code.GET_ERR,null);
        }
    }

    @RequestMapping("/dep_login")
    public Result dep_login(int id,String password){
        User user = loginService.Dep_login(id, password);
        if(user!= null){
            return new Result(Code.GET_OK,user);
        }else{
            return new Result(Code.GET_ERR,null);
        }
    }
    @RequestMapping("/lead_login")
    public Result Lead_login(int id,String password){
        User user = loginService.lead_login(id, password);
        if(user!= null){
            return new Result(Code.GET_OK,user);
        }else{
            return new Result(Code.GET_ERR,null);
        }
    }

}
